package com.yd.app.mapper;

import com.yd.domain.sys.AppPic;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 *
 * Created by sxh on 2018/6/5.
 */
@Repository
public interface AppPicMapper {

    /**
     * 查询列表
     * @return
     */
    @Select("select * from sys_app_pic order by sort")
    List<AppPic> getAppPicList();

    /**
     * 删除代理商信息
     * @param appPicId
     */
    @Select("delete from sys_app_pic where id=#{appPicId} ")
    void deleteAppPicById(@Param("appPicId") String appPicId);

    /**
     * 添加代理商
     * @param appPic
     */
    @Select("insert into sys_app_pic (id,title,iconUrl,sort) values (#{appPic.id},#{appPic.title},#{appPic.iconUrl},#{appPic.sort})")
    void addAppPic(@Param("appPic") AppPic appPic);
    /**
     * 修改代理商
     * @param appPic
     */
    @Update("update sys_app_pic set title=#{a.title},iconUrl=#{a.iconUrl},sort=#{a.sort} where id=#{a.id} ")
    void updateAppPic(@Param("a") AppPic appPic);
//    /**
//     * 获取登录用户所注册的代理
//     * @param userId
//     * @return
//     */
//    @Select("select a.* from sys_user u left join sys_app_pic a on u.appPicId=a.id where u.id=#{userId}  ")
//    AppPic getAppPicByUser(@Param("userId") String userId);
}
